﻿// -------------------------------------------------------------------------------------------------------------------------------
// <copyright file="TestAddFactor.cs" company="Exul">
//     Copyright (c) Exul. All rights reserved.
// </copyright>
// <author>
//     Exul
// </author>
// -------------------------------------------------------------------------------------------------------------------------------

namespace ExulLibrary.Mathematics.LinearAlgebra.Sequential.Tests.RMDenseMatrixTest.DoubleExtensions
{
    #region Usings

    using System;

    using ExulLibrary.Mathematics.LinearAlgebra.Sequential.DoubleExtensions;

    using NUnit.Framework;

    #endregion

    /// <summary>
    ///     Test suite for <see cref="RMDenseMatrixExtensions.Add(RMDenseMatrix{double},double)"/>.
    /// </summary>
    [TestFixture]
    [Category("ExulLibrary.Mathematics.LinearAlgebra.Sequential.DoubleExtensions.RMDenseMatrixExtensions")]
    public sealed class TestAddFactor
    {
        /// <summary>
        ///     Tests the method.
        /// </summary>
        [Test]
        public void TestMethod()
        {
            // Arrange
            var data = new[]
                       {
                           new double[] { 1, 2, 3 },
                           new double[] { 4, 5, 6 }
                       };
            var matrix = new RMDenseMatrix<double>(data);
            var expectedData = new[]
                               {
                                   new double[] { 11, 12, 13 },
                                   new double[] { 14, 15, 16 }
                               };

            // Act
            matrix.Add(10);

            // Assert
            Assert.That(matrix.Values, Is.EquivalentTo(expectedData));
        }

#if SAFE

        /// <summary>
        ///     Tests the method when matrix parameter is <see langword="null"/>.
        /// </summary>
        [Test]
        public void WhenMatrixIsNull()
        {
            // Act and Assert
            Assert.That(
                () => RMDenseMatrixExtensions.Add(null, 10),
                Throws.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("matrix"));
        }

#endif
    }
}